{__NOLAYOUT__}
<layout name="no_nav" />

<!-- 头像 -->
<section class="my-head">
  <figure class="my-head-content">
    <p class="my-head-img">
      <img id="head" src="{$user.face}" alt="" style="border-radius: 50%;">
      <input id="upload-head" class="my-header-file-input" type="file" accept="image/*">
    </p>
    <p class="my-head-name">{$user.nickname}</p>
  </figure>
</section>

<div class="pr-address-edit">

  <form method="post" action="saveDeliverAddressPost" id="form" class="form">

    <div class="form-item">
      <label class="form-item-label">真实姓名</label>
      <input type="text" name="realName" placeholder="请输入真实姓名" value="" data-nullmsg="请填写真实姓名">
    </div>

    <div class="form-item">
      <label class="form-item-label">手机号码</label>
      <input type="tel" name="tel" placeholder="填写正确手机号码" value="" data-nullmsg="请填写手机号码" data-type="m" data-errormsg="填写的手机号码格式不正确">
    </div>
    
    <div class="form-item">
      <label class="form-item-label">身份证号</label>
      <input type="idnum" name="idnum" placeholder="填写身份证号码" value="" data-nullmsg="填写身份证号码" data-type="*">
    </div>
    
    <div class="form-item">
      <label class="form-item-label">微信号</label>
      <input type="text" name="wechat" placeholder="填写您的微信号" value="" data-nullmsg="填写您的微信号">
    </div>
    
    <div class="form-item">
      <label class="form-item-label">QQ号码</label>
      <input type="text" name="qq" placeholder="填写您的QQ号码" value="" data-nullmsg="填写您的QQ号码" data-type="*">
    </div>
    
    <div class="form-item">
     <input type="hidden" name="sid" value="{$sid}">
     <button type="submit" class="btn btn-orange pr-btn w100">确认提交</button>
    </div>
    
  </form>
</div>
 
<script type="text/javascript">
  $(function() {

    $("#form").on("submit", function(e) {
      e.preventDefault();
      APP.checkForm(this, postAddress);
    });

    function postAddress() {
      var data = $(this).serializeArray();
      $.post("__CONTROLLER__/applyPost", data, function(response) {
        if ( response.error === 0 ) {
          APP.alert( "保存成功" );
          window.href.reload();
        } else {
          APP.alert( response.msg );  
        };
      });
    };

  });
</script>